how to properly edit hosts, hostname and resolf.conf? [migrated]

Posted by Firewall on Server Fault See other posts from Server Fault or by Firewall
Published on 2012-04-02T22:16:13Z Indexed on 2012/04/02 23:32 UTC
Read the original article Hit count: 200

Filed under:
|
|

i,v been searching the internet for a real noop tutorial on the subject but could not found any direct info. on how to edit these files the proper way.

i,v got a debian internet server that i use to host some personal domains and runs squid and rTorrent. the server is up and running with no problems but i am confused about a few things.

lets say that i named my server (foo), my domain is (example.com) and my public IP is 95.211.133.200 now:

  1. should /etc/hostname contains:

    tango.example.com
    

    or

    tango <----- just the server name
    
  2. should /etc/hosts contains:

    127.0.0.1       localhost.localdomain   localhost
    95.211.133.200  foo.example.com         foo
    
  3. should /etc/resolf.conf contains (along with the nameservers) both:

    domain example.com
    search example.com
    

    or just the first one.

    are there any other files that i should edit in order to make things right?

  4. last thing, the command:

    domainname
    
    returns: (none)
    

    i believe it should return (example.com). what should i do to correct that?

© Server Fault or respective owner

Related posts about linux

Related posts about hostname